﻿/*
   Copyright 2012 University of Southampton

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Collections.Generic;

namespace uk.ac.soton.ses.layouts
{
    public partial class Admin : LayoutsPageBase
    {

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            this.Page.AddHDCStylesheet();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Get the configuration options so we can display them and create link to edit them
            HDCConfigurationOptions configOptions = HDCConfiguration.GetConfigurationOptions();

            //FileSystemWatcherOptions Grid
            this.view_FileSystemWatcherOptions.DataSource = new List<HDCConfigurationOptionsFileSystemWatcher>() { configOptions.FileSystemWatcherOptions };
            this.view_FileSystemWatcherOptions.DataBind();
            //FileSystemWatcherOptions edit URL
            int filesystemwatcherconfigid = configOptions.FileSystemWatcherOptions.ConfigurationContainerID;
            this.link_FileSystemWatcherOptions.NavigateUrl = HDCConfiguration.GetUrl_ExperimentDetails(filesystemwatcherconfigid);

            //SharePointOptions Grid
            this.view_SharePointOptions.DataSource = new List<HDCConfigurationOptionsSharePoint>() { configOptions.SharePointOptions };
            this.view_SharePointOptions.DataBind();
            //SharePointOptions edit URL
            int sharepointoptionsconfigid = configOptions.SharePointOptions.ConfigurationContainerID;
            this.link_SharePointOptions.NavigateUrl = HDCConfiguration.GetUrl_ExperimentDetails(sharepointoptionsconfigid);
        }
    }
}
